package com.notice.rule.print;

import ch.qos.logback.classic.spi.ILoggingEvent;
import com.notice.entity.NoticePrint;
import org.springframework.stereotype.Component;

/**
 * 错误信息打印
 *
 * @author DZL
 * @date 2023/1/13 12:11
 */
@Component
public class ErrorMsgProcess extends AbstractNoticeMsgProcessHandler {
    @Override
    int order() {
        return -2;
    }

    @Override
    NoticePrint printProcessing(ILoggingEvent event, NoticePrint noticePrint) {
        String msg = "发生异常的类：" + event.getLoggerName() + "\n" +
                "异常信息：" + event.getFormattedMessage() + "\n";
        noticePrint.setErrorMsg(msg);
        return noticePrint;
    }
}
